using B.S.NewMedical.Api.Read.Application.Command.Drug;
using B.S.NewMedical.Api.Read.DTOS.Drug;
using B.S.NewMedical.ErrorCode;
using MediatR;
using Microsoft.AspNetCore.Mvc;
using System.Collections.Generic;
using System.Threading.Tasks;

namespace B.S.NewMedical.Api.Read.Controllers
{
    [Route("api/[controller]")]
    [ApiController]
    public class DrugController : ControllerBase
    {
        private readonly IMediator _mediator;

        public DrugController(IMediator mediator)
        {
            _mediator = mediator;
        }

        /// <summary>
        /// 获取所有药品类型
        /// </summary>
        /// <returns>药品类型列表</returns>
        [HttpGet("categories")]
        public async Task<ApiResult<List<DrugCategoryDto>>> GetAllDrugCategories()
        {
            return await _mediator.Send(new GetAllDrugCategoriesCommand());
        }
    }
} 